package com.site.controller.site;

import com.site.service.BannerService;
import com.site.service.InfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created by robin on 2016/12/19.
 * 慧知人才 controller
 */
@Controller
@RequestMapping("personnel")
public class PersonnelController {
    @Autowired
    private BannerService bannerService;
    @Autowired
    private InfoService   infoService;

    @RequestMapping("recruit")
    public String recruit(Model model){
        model.addAttribute("plate","personnel");
        model.addAttribute("banner",bannerService.selectByCate("personnel"));
        return "site/personnel/recruit";
    }

    @RequestMapping("recruitList")
    public String recruitList(Model model,int pageNum){
		
        model.addAttribute("recruit",infoService.selectByCate("perRecruit",pageNum,10));
        return "site/personnel/recruitList";
    }

    @RequestMapping("recruitInfo")
    public String recruitInfo(Model model,String recruit){
        model.addAttribute("plate","personnel");
        model.addAttribute("banner",bannerService.selectByCate("personnel"));
        model.addAttribute("recruit",infoService.selectInfo(recruit));
        return "site/personnel/recruitInfo";
    }

    @RequestMapping("expert")
    public String expert(Model model){
        model.addAttribute("plate","personnel");
        model.addAttribute("banner",bannerService.selectByCate("personnel"));
        model.addAttribute("expert",infoService.selectByCate("perExpert"));
        return "site/personnel/expert";
    }

    @RequestMapping("expertInfo")
    public String expertInfo(Model model,String expert){
        model.addAttribute("plate","personnel");
        model.addAttribute("banner",bannerService.selectByCate("personnel"));
        model.addAttribute("expert",infoService.selectInfo(expert));
        return "site/personnel/expertInfo";
    }
}
